/* 全局样式和重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f7fa;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 页面容器 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 头部样式 */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem 0;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

.header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* 主内容区 */
.main-content {
    padding: 2rem 0;
}

/* 发布按钮 */
.publish-btn-container {
    text-align: center;
    margin-bottom: 2rem;
}

#publishBtn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

#publishBtn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

#publishBtn:active {
    transform: translateY(-1px);
}

/* 筛选区域 */
.filter-section {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.filter-section h2 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    color: #333;
}

.filter-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    align-items: end;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #555;
}

.form-group select,
.form-group input {
    padding: 0.8rem;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group select:focus,
.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.filter-actions {
    display: flex;
    gap: 1rem;
}

.btn-primary,
.btn-secondary {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background-color: #667eea;
    color: white;
}

.btn-primary:hover {
    background-color: #5a67d8;
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: #e2e8f0;
    color: #4a5568;
}

.btn-secondary:hover {
    background-color: #cbd5e0;
    transform: translateY(-1px);
}

/* 帖子列表 */
.posts-section {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.posts-section h2 {
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
    color: #333;
}

#postsContainer {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
}

/* 帖子卡片 */
.post-card {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.post-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border-color: #667eea;
}

.post-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.post-type {
    padding: 0.3rem 0.8rem;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
}

.post-type.lost {
    background-color: #fef5e7;
    color: #f39c12;
}

.post-type.found {
    background-color: #eafaf1;
    color: #27ae60;
}

.post-date {
    font-size: 0.85rem;
    color: #94a3b8;
}

.post-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #1e293b;
}

.post-location {
    font-size: 0.9rem;
    color: #64748b;
    margin-bottom: 0.8rem;
    display: flex;
    align-items: center;
}

.post-location::before {
    content: '📍';
    margin-right: 0.5rem;
}

.post-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.post-status {
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-weight: 500;
    font-size: 0.8rem;
}

.post-status.active {
    background-color: #e6fffa;
    color: #0d9488;
}

.post-status.expired {
    background-color: #fee2e2;
    color: #ef4444;
}

.post-description {
    color: #64748b;
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 1.2rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.contact-btn {
    width: 100%;
    padding: 0.8rem;
    background-color: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.contact-btn:hover {
    background-color: #5a67d8;
    transform: translateY(-1px);
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.active {
    opacity: 1;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(-20px);
    transition: transform 0.3s ease;
}

.modal.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.3rem;
    color: #1e293b;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #94a3b8;
    transition: color 0.3s ease;
}

.close-btn:hover {
    color: #64748b;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

/* 表单样式 */
.form-title {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    color: #1e293b;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.form-check input[type="radio"] {
    width: auto;
}

.form-check label {
    cursor: pointer;
    font-weight: 400;
}

textarea {
    width: 100%;
    padding: 0.8rem;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    min-height: 100px;
    transition: border-color 0.3s ease;
}

textarea:focus {
    outline: none;
    border-color: #667eea;
}

/* 留言模态框 */
.message-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 600px) {
    .message-container {
        grid-template-columns: 1fr;
    }
}

.post-detail {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem;
}

.post-detail h4 {
    margin-bottom: 1rem;
    color: #1e293b;
}

.post-detail p {
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.post-detail strong {
    color: #334155;
}

.messages-list {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem;
}

.messages-list h4 {
    margin-bottom: 1rem;
    color: #1e293b;
}

.messages-container {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 1rem;
}

.message-item {
    padding: 1rem;
    border: 1px solid #f1f5f9;
    border-radius: 8px;
    margin-bottom: 1rem;
    background-color: #f8fafc;
}

.message-header {
    font-size: 0.85rem;
    color: #94a3b8;
    margin-bottom: 0.5rem;
}

.message-content {
    font-size: 0.95rem;
    color: #334155;
    margin-bottom: 0.5rem;
}

.message-contact {
    font-size: 0.85rem;
    color: #64748b;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #94a3b8;
}

.empty-state h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: #64748b;
}

.empty-state p {
    margin-bottom: 1.5rem;
}

/* 加载动画 */
.loading {
    display: flex;
    justify-content: center;
    padding: 3rem;
}

.loading::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 4px solid #e2e8f0;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 通知提示样式 */
.notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 1rem 1.25rem;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    animation: notification-slide-in 0.3s ease-out;
    max-width: 350px;
}

@keyframes notification-slide-in {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.notification-success {
    background-color: #27ae60;
}

.notification-error {
    background-color: #e74c3c;
}

.notification-info {
    background-color: #3498db;
}

/* 加载动画 */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
    position: relative;
}

.loading::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 重置按钮样式优化 */
#resetFilterBtn {
    background-color: #ecf0f1;
    color: #2c3e50;
}

#resetFilterBtn:hover {
    background-color: #bdc3c7;
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(148, 163, 184, 0.3);
}

/* 自定义滚动条 */
.messages-container::-webkit-scrollbar {
    width: 6px;
}

.messages-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.messages-container::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

.messages-container::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* 详情模态框中的内容样式 */
#postDetail {
    padding: 10px 0 20px;
    line-height: 1.7;
}

#postDetail p {
    margin-bottom: 12px;
}

/* 留言表单样式 */
.message-form-group {
    margin-bottom: 15px;
}

#messageContent {
    min-height: 100px;
}

/* 打印样式 */
@media print {
    .filter-section,
    .btn,
    .modal,
    .notification {
        display: none;
    }
    
    .post-card {
        break-inside: avoid;
        margin-bottom: 20px;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .header h1 {
        font-size: 2rem;
    }
    
    #postsContainer {
        grid-template-columns: 1fr;
    }
    
    .filter-form {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        width: 95%;
        margin: 1rem;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.8rem;
    }
    
    .post-card {
        padding: 1rem;
    }
    
    .modal-body {
        padding: 1rem;
    }
}

/* 打印样式 */
@media print {
    .header,
    .filter-section,
    .publish-btn-container,
    .modal {
        display: none;
    }
    
    .post-card {
        break-inside: avoid;
        border: 1px solid #ccc;
        page-break-inside: avoid;
    }
}

/* 无障碍支持 */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* 高对比度模式 */
@media (prefers-contrast: high) {
    .post-card {
        border: 2px solid currentColor;
    }
    
    .form-group select,
    .form-group input,
    textarea {
        border: 2px solid currentColor;
    }
}